SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO







CREATE PROCEDURE [dbo].[usp_AddLecture]
    (
      --@JOL_Lecture_Purpose VARCHAR(50),--场地用途
      @JOL_Lecture_Title VARCHAR(50) ,--活动标题
      @JOL_Lecture_Linkman VARCHAR(50) ,--联系人
      @JOL_Lecture_Mobile VARCHAR(50) ,--手机
      @JOL_Lecture_Email VARCHAR(50) ,--邮件
      @JOL_Lecture_Phone VARCHAR(50) ,--电话
      @JOL_Lecture_Fax VARCHAR(50) ,--传真
      @JOL_Lecture_Body NTEXT ,--正文
      @JOL_Lecture_IsSetTop BIT ,--是否置顶
      @JOL_Lecture_RequireNumber INT ,--拟招人数
      @JOL_Lecture_RequireStudyLevel VARCHAR(50) ,--学历要求
      @JOL_Lecture_AddTime DATETIME ,--添加时间
      @JOL_Lecture_AddUser VARCHAR(50) ,--添加账户
      @JOL_Field_ApplyCompany VARCHAR(50) ,--申请单位 
      @JOL_Field_ApplyTime DATETIME ,--申请时间
      @JOL_Field_ApplyPosition VARCHAR(50) ,--地点
      @JOL_Field_SeatNumber INT ,--场地申请人数
      @JOL_Field_IsProvideMultimedia BIT ,--是否提供多媒体
      @JOL_Field_IsNeedInvoice BIT ,--是否需要发票
      @JOL_Field_InvoiceBeginning VARCHAR(50) ,--发票开头
      @JOL_Field_InvoiceProject VARCHAR(50) ,--发票项目
      @JOL_Field_IsPaidMoney BIT ,--是否已缴费，中心管理员填写
      @JOL_Field_AddTime DATETIME ,--添加时间
      @JOL_Field_AddUser VARCHAR(50) ,--添加账户
      @JOL_Field_Remark NTEXT ,--备注	
      @JOL_Lecture_VerifyStatus VARCHAR(50) ,
      @JOL_ApplyField_EndTime DATETIME ,
      @JOL_ApplyField_VerifyUser VARCHAR(50)
    )
AS 
    INSERT  INTO dbo.JOL_ApplyField--先插入场地申请记录
            ( JOL_Field_ApplyCompany ,
              JOL_Field_Purpose ,
              JOL_Field_Linkman ,
              JOL_Field_Contact ,
              JOL_Field_Action ,
              JOL_Field_ApplyTime ,
              JOL_Field_ApplyPosition ,
              JOL_Field_SeatNumber ,
              JOL_Field_IsProvideMultimedia ,
              JOL_Field_IsNeedInvoice ,
              JOL_Field_InvoiceBeginning ,
              JOL_Field_InvoiceProject ,
              JOL_Field_IsPaidMoney ,
              JOL_Field_AddTime ,
              JOL_Field_AddUser ,
              JOL_Field_UpdateTime ,
              JOL_Field_UpdateUser ,
              JOL_Field_VerifyStatus ,
              JOL_Field_VerifyUser ,
              JOL_Field_IsSendEmail ,
              JOL_Field_Remark ,
              JOL_ApplyField_EndTime ,
              JOL_ApplyField_Phone ,
              JOL_ApplyField_Fax ,
              JOL_ApplyField_Email
            )
    VALUES  ( @JOL_Field_ApplyCompany , -- JOL_Field_ApplyCompany - varchar(50)
              '宣讲会' , -- JOL_Field_Purpose - varchar(50)
              @JOL_Lecture_Linkman , -- JOL_Field_Linkman - varchar(50)
              @JOL_Lecture_Mobile , -- JOL_Field_Contact - varchar(50)
              @JOL_Lecture_Title , -- JOL_Field_Action - varchar(100)
              @JOL_Field_ApplyTime , -- JOL_Field_ApplyTime - datetime
              @JOL_Field_ApplyPosition , -- JOL_Field_ApplyPosition - varchar(50)
              @JOL_Field_SeatNumber , -- JOL_Field_SeatNumber - int
              @JOL_Field_IsProvideMultimedia , -- JOL_Field_IsProvideMultimedia - bit
              @JOL_Field_IsNeedInvoice , -- JOL_Field_IsNeedInvoice - bit
              @JOL_Field_InvoiceBeginning , -- JOL_Field_InvoiceBeginning - varchar(50)
              @JOL_Field_InvoiceProject , -- JOL_Field_InvoiceProject - varchar(50)
              @JOL_Field_IsPaidMoney , -- JOL_Field_IsPaidMoney - bit
              GETDATE() , -- JOL_Field_AddTime - datetime
              @JOL_Field_AddUser , -- JOL_Field_AddUser - varchar(50)
              NULL , -- JOL_Field_UpdateTime - datetime
              NULL , -- JOL_Field_UpdateUser - varchar(50)
              @JOL_Lecture_VerifyStatus , -- JOL_Field_VerifyStatus - varchar(50)
              @JOL_ApplyField_VerifyUser , -- JOL_Field_VerifyUser - varchar(50)
              0 , -- JOL_Field_IsSendEmail - bit
              @JOL_Field_Remark , -- JOL_Field_Remark - ntext
              @JOL_ApplyField_EndTime ,
              @JOL_Lecture_Phone ,
              @JOL_Lecture_Fax ,
              @JOL_Lecture_Email
            )
    DECLARE @ID INT
    SET @ID = ( SELECT  @@IDENTITY
              )
    INSERT  INTO dbo.JOL_Lecture
            ( JOL_Lecture_Purpose ,
              JOL_Lecture_Title ,
              JOL_Lecture_Linkman ,
              JOL_Lecture_Mobile ,
              JOL_Lecture_Email ,
              JOL_Lecture_Phone ,
              JOL_Lecture_Fax ,
              JOL_Lecture_ClickNumber ,
              JOL_Lecture_Body ,
              JOL_Lecture_IsSetTop ,
              JOL_Lecture_RequireNumber ,
              JOL_Lecture_RequireStudyLevel ,
              JOL_Lecture_AddTime ,
              JOL_Lecture_AddUser ,
              JOL_Lecture_UpdateTime ,
              JOL_Lecture_UpdateUser ,
              JOL_Lecture_VerifyStatus ,
              JOL_Lecture_VerifyUser ,
              JOL_Lecture_VerifyTime ,
              JOL_Lecture_IsSendEmail
            )
    VALUES  ( @ID ,
              @JOL_Lecture_Title , -- JOL_Lecture_Title - varchar(50)
              @JOL_Lecture_Linkman , -- JOL_Lecture_Linkman - varchar(50)
              @JOL_Lecture_Mobile , -- JOL_Lecture_Mobile - varchar(50)
              @JOL_Lecture_Email , -- JOL_Lecture_Email - varchar(50)
              @JOL_Lecture_Phone , -- JOL_Lecture_Phone - varchar(50)
              @JOL_Lecture_Fax , -- JOL_Lecture_Fax - varchar(50)
              0 , -- JOL_Lecture_ClickNumber - int
              @JOL_Lecture_Body , -- JOL_Lecture_Body - ntext
              @JOL_Lecture_IsSetTop , -- JOL_Lecture_IsSetTop - bit
              @JOL_Lecture_RequireNumber , -- JOL_Lecture_RequireNumber - int
              @JOL_Lecture_RequireStudyLevel , -- JOL_Lecture_RequireStudyLevel - varchar(50)
              GETDATE() , -- JOL_Lecture_AddTime - datetime
              @JOL_Lecture_AddUser , -- JOL_Lecture_AddUser - varchar(50)
              NULL , -- JOL_Lecture_UpdateTime - datetime
              NULL , -- JOL_Lecture_UpdateUser - varchar(50)
              @JOL_Lecture_VerifyStatus , -- JOL_Lecture_VerifyStatus - varchar(50)
              @JOL_ApplyField_VerifyUser , -- JOL_Lecture_VerifyUser - varchar(50)
              CASE @JOL_Lecture_VerifyStatus
                WHEN '已审核' THEN GETDATE()
                ELSE NULL
              END , -- JOL_Lecture_VerifyTime - datetime
              0-- JOL_Lecture_IsSendEmail - bit
            )









GO
